UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1B1/mBbTWYBvi8PYkGmM171zVObSBTaiyRsXhISTPoU=' 
WHERE 
  key_id = 'f27380b067f0a5d3202dad3a71dd985c706cd2b989c9cb926a81046555d49c5a' 
  AND (
    token = '1B1/mBbTWYBvi8PYkGmM171zVObSBTaiyRsXhISTPoU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040