UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A7fv4VBywiWbPIfYHbb61N7rCgRXSsHDnPLkOfGJtXE=' 
WHERE 
  key_id = '6dfeff02b33efe7112d5025e8cb4f281ac532fe2429fa70478f218c78c3b5724' 
  AND (
    token = 'A7fv4VBywiWbPIfYHbb61N7rCgRXSsHDnPLkOfGJtXE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047