UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NP2cLwLVp5C8zEu2lJJrsryp/31DG2KjutRR/h+6+0U='
WHERE
key_id = '5ac9a80874cc9a383fd804d760f8b09f0d3eade77b7cc3344138edfbe488250d'
AND (
token = 'NP2cLwLVp5C8zEu2lJJrsryp/31DG2KjutRR/h+6+0U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)