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