UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rZ2BHX+30Pz0mFwrvxvWptMCMWspjAoDT+Civ9cgBcg=' 
WHERE 
  key_id = '7d8f967cfc5aa84a582583b8787d6fb8e006530be1d6e9162aac7ff73728cdbd' 
  AND (
    token = 'rZ2BHX+30Pz0mFwrvxvWptMCMWspjAoDT+Civ9cgBcg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040