UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fTpigoK7OaPKnqIFIfPISN54iQqjx2xd9sFQ1HDamAk='
WHERE
key_id = '04394691185a8e60732026c1345623b89b7d765472be656aad4c2e61e2da2555'
AND (
token = 'fTpigoK7OaPKnqIFIfPISN54iQqjx2xd9sFQ1HDamAk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)