UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'diDsfYgfqAZc5cDWePq7LfyRKiWPLUzZOCYQK84NLjo='
WHERE
key_id = '11475d27f75787f989c029a7faae53e52e4357eecbbcc5242b3f5d32b7815fc1'
AND (
token = 'diDsfYgfqAZc5cDWePq7LfyRKiWPLUzZOCYQK84NLjo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)