UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Itx7kku8FE6jpvSSaHPKblEwNaLHj6IQ6KGQurJ/2Xw=' 
WHERE 
  key_id = '1c28fcab08a8411cef34e050aa52a2b0661acad24769834f432958698db786a5' 
  AND (
    token = 'Itx7kku8FE6jpvSSaHPKblEwNaLHj6IQ6KGQurJ/2Xw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056