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

Query time 0.00028