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

Query time 0.00048