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