UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nH0osZ5Bt6DFpvQo4SI69Cnoc6AxpxUNBnUA8DYa8II=' 
WHERE 
  key_id = 'd80facd9144c3620f10cb85706f9d2d786da27182f4d30617e695748da10d4bd' 
  AND (
    token = 'nH0osZ5Bt6DFpvQo4SI69Cnoc6AxpxUNBnUA8DYa8II=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027