UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iSdeqvKIqA6xI2/qOgb1C4pOgjPVnS6L9cEy/216MK4='
WHERE
key_id = '58fd6440761a0c439687cdcbe3053443e5771db286999827cb49c1bf93271fe7'
AND (
token = 'iSdeqvKIqA6xI2/qOgb1C4pOgjPVnS6L9cEy/216MK4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)