UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BSCKUkJMPEA+KLi+faC1jMHiAfd9vSJm+4jhklKmfCE=' 
WHERE 
  key_id = 'ffc1e54febeb2350aa6ce3f22cf2f2de5e11757046ae6130054be4bd28b52924' 
  AND (
    token = 'BSCKUkJMPEA+KLi+faC1jMHiAfd9vSJm+4jhklKmfCE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029