UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j31JGVPE5PuHd5UzS4T7zcYM24qUgEoPd2+VfCCKMkM='
WHERE
key_id = 'a1c2e16ef471d1a98076b3ca6692cae0dfd118e313d79fa70314733e354d666c'
AND (
token = 'j31JGVPE5PuHd5UzS4T7zcYM24qUgEoPd2+VfCCKMkM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)