UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vk40cYUAuA4hyuUrCCmTm6QqHMN7lOm3DZeE+SYVWw4='
WHERE
key_id = 'e7c8cd96924ee5c32c166a1487b93e05fb8576c5be5e1dad0a1699556daa8a00'
AND (
token = 'vk40cYUAuA4hyuUrCCmTm6QqHMN7lOm3DZeE+SYVWw4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)