UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tmFgZIypFJ6JZil6Tp074SHSA4O2yMrfp5E9+RSGkE0=' 
WHERE 
  key_id = '372bd507b92eb10466f82a107c2327a5db49a51d9dfcecd2d18dfdde3028b93b' 
  AND (
    token = 'tmFgZIypFJ6JZil6Tp074SHSA4O2yMrfp5E9+RSGkE0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044