UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q6M/Ne2BO+20LwJsr0LJrm+w8VyeGo7rZ0rtjlBqVTE=' 
WHERE 
  key_id = '7485bae87e751463b8b16d31e369a4eff1ce54ec5a613d7fec2cfce32626fd78' 
  AND (
    token = 'q6M/Ne2BO+20LwJsr0LJrm+w8VyeGo7rZ0rtjlBqVTE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037