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