UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AdAJ4JhSGqzZO8uXjEhzRpMIB3nSMLRtHqMfwy2ysp4='
WHERE
key_id = 'd8801453fba8127657521b7ed93ae9b39890043e0b42fea461f2b00eab6b87e1'
AND (
token = 'AdAJ4JhSGqzZO8uXjEhzRpMIB3nSMLRtHqMfwy2ysp4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)