UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rK2L7td3DJjJZndOF6XDQSFLHDTxiHokNMtwvgkSC+Y='
WHERE
key_id = 'a2bf771a834fd14c8c7728c40347a53a71596e7d157324082e895006560b3305'
AND (
token = 'rK2L7td3DJjJZndOF6XDQSFLHDTxiHokNMtwvgkSC+Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)