UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D1O6KYYoZlwhv+TqSChaHInULrLU2UsAumnCUga+3+Y=' 
WHERE 
  key_id = 'ab04faf249e0ad74d29425794b10f3d1a75247b29c6e6c42e43b2b2a18cca897' 
  AND (
    token = 'D1O6KYYoZlwhv+TqSChaHInULrLU2UsAumnCUga+3+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023