UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7mPulQLP0wLPx+E7aMxX2SBpEkFfpIzo/Y+4I0T+tSs=' 
WHERE 
  key_id = '5cb3e9f3b5f18309820b9a69785b84fc08060595441d49c9d8afb012a749f262' 
  AND (
    token = '7mPulQLP0wLPx+E7aMxX2SBpEkFfpIzo/Y+4I0T+tSs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039