UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8EawJKMbH2RlVamOojJCC0oJ9qD3nDzPHLz34YyL3p4='
WHERE
key_id = 'bdcbf0788805374fb66f663f0b9d81013d0027619e5a362254464cf966dd91ba'
AND (
token = '8EawJKMbH2RlVamOojJCC0oJ9qD3nDzPHLz34YyL3p4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)