UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2i0YMs1GjM4dxNG2M8bthX0VqJrVMDs2u+OCTxgZlb8='
WHERE
key_id = 'e7d6b600b1731b0f726534a41930c6cbc7c52720e7b8951e5c13e80b65ecb126'
AND (
token = '2i0YMs1GjM4dxNG2M8bthX0VqJrVMDs2u+OCTxgZlb8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)