UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2u4v/qHXjJm0VMy+g+12xiCBIAL6pNryyudo32TD9y0='
WHERE
key_id = 'd9aabbc0b172b9c0bae50af38d097ce0230bd761c1028114ad0ece358509755a'
AND (
token = '2u4v/qHXjJm0VMy+g+12xiCBIAL6pNryyudo32TD9y0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)