UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hYqFocAAXCC9NY37SLqI6cnSF7YzrhbPzmvCubMILyw=' 
WHERE 
  key_id = '709abd1c10dd8d36a3400d77525763b07495b5a31b1bf7d4b889f4d8d264967b' 
  AND (
    token = 'hYqFocAAXCC9NY37SLqI6cnSF7YzrhbPzmvCubMILyw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023