UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pDfiGjN02h8iETGmfdTBIZG9vEam3ge3GFAxmxbEAxU=' 
WHERE 
  key_id = '439b560a7182ed237f45bcebb198e6547520c0d185a11f286ba56447f596b01b' 
  AND (
    token = 'pDfiGjN02h8iETGmfdTBIZG9vEam3ge3GFAxmxbEAxU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030