UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u8BU3gVHy47CVKBvC003/wyyc+ocwmLU9RskLw6GNNo=' 
WHERE 
  key_id = '01e014a7f01d675d223c42059059616ccc7946bd4e17a6b79c03924985d73953' 
  AND (
    token = 'u8BU3gVHy47CVKBvC003/wyyc+ocwmLU9RskLw6GNNo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041