UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6uTvCwzrU2COeNGUUG+GuX/+big3iB9YXXNDQn3Ni/k=' 
WHERE 
  key_id = '2648dd65dfc70b358bb68cc369ccde0749b7a1acd5dd6a230312456063a17431' 
  AND (
    token = '6uTvCwzrU2COeNGUUG+GuX/+big3iB9YXXNDQn3Ni/k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032