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