UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k0EeSBRpirCY8BB01IY2c5liY7aHF+gHX5h2Fx0SzYo=' 
WHERE 
  key_id = '510cde11f940b63fd9fd21aa0ab5f121845292074925007413b73ff340b1c509' 
  AND (
    token = 'k0EeSBRpirCY8BB01IY2c5liY7aHF+gHX5h2Fx0SzYo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031