UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PGi2m31CKg8ok6we1TltnDW2+DIf1O3rsTlxWgyGyyg='
WHERE
key_id = '4784886e6011244c4a7c4e791f17aabbdee068bbde0843212c7b092a6a42ad0a'
AND (
token = 'PGi2m31CKg8ok6we1TltnDW2+DIf1O3rsTlxWgyGyyg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)