UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Eg3bbX1+TvBMZZSosggLQnXqIWRJFmKi6rsUtrjVbDA=' 
WHERE 
  key_id = '1f8afa336da94e054658df9771927bb6381d7ffbc12f2bf77bb892275cb81201' 
  AND (
    token = 'Eg3bbX1+TvBMZZSosggLQnXqIWRJFmKi6rsUtrjVbDA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028