UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rgQ0RUMm44vuJiPaKclmr/xVCUxkHMk99CbTkfagA0g=' 
WHERE 
  key_id = '5cf4fe4c1479490cf129765f5815654f01ea05e58f5505c874843da417c1c9d6' 
  AND (
    token = 'rgQ0RUMm44vuJiPaKclmr/xVCUxkHMk99CbTkfagA0g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040