UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X1QuXpT+5zkg0gSrJrIQwXKY1CF3139XjkWY0a32McM=' 
WHERE 
  key_id = 'a6a7f3e388863d8048b5d307f001a41d052f55975d1e1b343d2205487fce9b13' 
  AND (
    token = 'X1QuXpT+5zkg0gSrJrIQwXKY1CF3139XjkWY0a32McM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031