UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l3utP0zbrdfPCQPLV343vDhdwOlP/Ws7VpMP8l94RcY=' 
WHERE 
  key_id = '8137a241fd9de9466de2c580744d34c904d8cc5de4760d5c89ed313e69975514' 
  AND (
    token = 'l3utP0zbrdfPCQPLV343vDhdwOlP/Ws7VpMP8l94RcY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038